package com.googlecode.quillen.repository;

import com.googlecode.quillen.domain.Attributes;
import com.googlecode.quillen.domain.AttributeStorageException;
import com.googlecode.quillen.util.Pair;
import com.googlecode.quillen.util.ResultConsumer;

import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: greg
 * Date: Dec 8, 2008
 * Time: 9:54:37 AM
 */
public interface AttributeStorage
{
    void createDatabase(String database) throws AttributeStorageException;

    void deleteDatabase(String database) throws AttributeStorageException;

    // TODO: bulk get?

    Attributes get(String database, String key, String... attributeNames) throws AttributeStorageException;

    void put(String database, String key, Attributes attributes) throws AttributeStorageException;

    void batchPut(String database, Map<String, Attributes> attributes) throws AttributeStorageException;

    void delete(String database, String key) throws AttributeStorageException;

    void delete(String database, String key, Attributes attributes) throws AttributeStorageException;

    void list(String database, ResultConsumer<Pair<String, Attributes>> consumer) throws AttributeStorageException;

    void find(String database, AttributeStorageQuery query, ResultConsumer<Pair<String, Attributes>> consumer) throws AttributeStorageException;
}
